/* 添加到我喜欢 */
function addLikes($this) {
	var chks = document.querySelectorAll('#songlist input[type="checkbox"]');
	var indexCurrent = $(".js_footestop").data("index");
    var listSelected = new Array();
    var arry = [];
    
    for (var i = 0; i < chks.length; i++) {
        var chk = chks[i];
        if(chk.checked){
        	listSelected.push({sid:chk.closest("li").getAttribute("data-songid")});
        	arry.push(chk.closest("li").getAttribute("data-index"));
        }
    }
    
    for(var i = 0; i<arry.length;i++){
    	// console.log(arry[i]);
    	$(".js_songli").eq(arry[i]).find(".js_lover i").removeClass("icon-aixinkong1").addClass("icon-aixin1").css("color","rgba(247, 59, 59, 0.8)");
    	$(".js_songlismalltest").eq(arry[i]).find(".js_lover i").removeClass("icon-aixinkong1").addClass("icon-aixin1").css("color","rgba(247, 59, 59, 0.8)");
    	$(".js_songlistheader").find(`.js_songli[data-index=${arry[i]}]`).find('.js_lover i').removeClass("icon-aixinkong1").addClass("icon-aixin1").css("color","rgba(247, 59, 59, 0.8)");
    	if(arry[i]==indexCurrent){
    		$(".js_loverfoot i").removeClass("icon-aixinkong1").addClass("icon-aixin1").css("color","rgba(247, 59, 59, 0.8)");
    	}
    }
	
    $.ajax({
		url : "music/addtosonglist/addtolikes",
		data : JSON.stringify(listSelected),
		dataType : "json",
		type : "post",
		contentType : 'application/json;charset=utf-8', 
		success : function(data) {
			if(data.Tip==true){
				$(".icheckbox_square-pink").removeClass("checked");
				$this.tip("谢谢成为你的最爱♪(^∇^*)");
			}else{
				$this.tip("添加失败╮(╯▽╰)╭");
			}
		},
		error : function(data) {
			$this.tip("添加失败╮(╯▽╰)╭");
		}
	});

}